"""
多态
    方法的多态，属性没有多态
    必要条件：继承和重写
"""


class Animal:
    def shout(self):
        print("动物叫")


class Dog(Animal):
    def shout(self):
        print("汪汪汪")


class Cat(Animal):
    def shout(self):
        print("喵喵喵")


def animal_shout(obj):
    obj.shout()


c = Cat()
animal_shout(c)
d = Dog()
animal_shout(d)
